home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 128 36
/
q36.d81
/
t.2 x font demo
< prev
next >
Wrap
Text File
|
2022-08-28
|
12KB
|
294 lines
2 x F O N T D E M O
Program and Text by Bob Markland
One distinct advantage the C-128 has over the C-64 is its 80-column
capability. But there are times when the standard character size just won't
do. Notice the banner at the top of the LOADSTAR-128 Presenter. The large
characters are defined within a special font, and consist of numerous
characters pieced together in a particular order.
This is fine when you have a repeated need for only one word or short
phrase. Of course, you can print other words which contain the same letters
as "LOADSTAR," or redefine the font with another word. But in any case you
don't have an entire large alphabet at your disposal.
Often it is desirable to have large text, using many different
characters on various screens. And the solution lies in the 8563 chip's
ability to display any of 512 characters (2 complete sets) simultaneously.
The C-64, on the other hand, can only display 256 characters at a time.
To allow characters to be displayed at two times their normal size I
designed 2 x FONT, which is a magnification of the standard LS-128 font --
then developed the techniques in the demo program to make full use of it.
When utilizing 2 x FONT, your program should also use CONTROL 80 to
move custom fonts into 8563 character memory. You could write your own M/L
font moving routines, but why re-invent the wheel? Besides, CONTROL80 is a
toolbox and provides many useful routines for the rest of your program.
Fender Tucker never writes an 80-column program without it.
To best understand how the demo uses 2 x FONT, you may find it
beneficial to print a hard copy of this text before you run the demo. The
text that follows describes in detail how each technique is used within a
program.
2 x FONT DEMO
-------------
10-70 - Move BASIC up to $4000. This is necessary to accommodate the custom
fonts. Then take care of some housekeeping.
For the demo two different arrays are used: AB$(63,2) and AB(63,4).
However, you need not use both of them in your own programs. Select the one
that does the job the way you prefer.
There are also some handy variables defined in this area:
AZ = 2048 - Address for 8563 attributes.
PLOT=65520 - Kernal PLOT routine to position the cursor.
RV$(x) - Define Reverse ON and OFF.
UC$ - Switch to uppercase.
LC$ - Switch to lowercase.
Load any custom font and FCOPY it to the uppercase/graphic font (0). Then
load 2 x FONT and FCOPY it to the lowercase font (1).
With this configuration you have the uppercase/graphic font for normal
size text, boxes, tiles, and other graphic shapes. The lowercase font is
used exclusively for double size characters. If you FCOPY the 2 x FONT to
the uppercase font (0) then you can use your custom font as the lowercase
font (1).
90-130 - The characters in the 2 x FONT are representative of the first 64
characters available in a standard font. READ DATA into a String array to
define the characters. The top half of each character is defined as
AB$(x,1) and the bottom half is AB$(x,2). Note that the CHR$ value of
characters 32-63 is merely a repeat of characters 0-31, and the same data
is reused.
150-130 - If your needs dictate, you can instead define a numeric array
AB(63,4) to hold the values in the DATA statements, then use:
PRINTCHR$(AB(screen code,segment)) at print time. Again, note that the data
is the same as when defining strings and is reused for the second half of
the array.
210-300 - This area of the program sets up a screen and is of no particular
significance to the discussion.
330 - This line illustrates one way to set up an array containing the
screen codes for the word "LOADSTAR". You can easily READ DATA into an
array to accomplish the same end.
340-360 - By using UC$ for normal text and LC$ for large characters you can
mix sizes at will anywhere on the screen. There are numerous ways to print
each large character. Experiment if you like, or use the following:
SYSPLOT,0,row,col,48 is a quick and easy way to place the cursor where
you want it. You can use POKE235,row: PRINT:PRINTTAB(col) but I find the
plot routine far more efficient. This is especially true because of the way
BASIC 7.0 handles the SYS command. When you use SYS, the parameters that
follow automatically load the Accumulator, X register, Y register, and
Status register with the proper values.
FENDER'S NOTE: I have always used CHAR to place the cursor on the 80-
column screen. As always, whatever works for you is fine with me, unless
it's so cryptic that an editor can't easily tell at a glance what the
coordinates are.
If you are wondering why the number 48 is placed in the Status register,
here's why: The Kernal Plot routine has two functions -- If the carry bit
in the status register is clear (0), Plot places the cursor at the defined
position on the screen. If the carry bit is set (1), Plot returns the
current cursor location in the X and Y registers. The use of 48 parameter
is purely precautionary. In a 100% BASIC program the carry bit should
always be clear. However if your program makes use of any M/L routines, it
may not. Use your own discretion.
PRINTRV$(ABS(character(R)>31)) is an easy way to automatically select
either reverse OFF or ON. Screen codes 0-31 result in zero (0) and 32-63
result in one (1).
PRINTAB$(R,1) prints the top half of the character.
"down,left,left" positions the cursor.
AB$(R,2) prints the bottom half of the character.
By altering the routine slightly, you can print an entire line consisting
of the top half of the characters, then print the bottom half on the next
line. I don't recommend this method, as there is a quirk in the BASIC PRINT
statement.
When the "A" or "!" characters, which contain quote (CHR$(34)) are
printed, the computer is forced into Quote Mode. If you use "up, up, right,
right" to position the cursor for the next character, garbage is printed to
the screen, and the cursor is not positioned properly. There is a solution
described in the discussion of line 950, or you can use some sort of plot
instead.
390 - You may find it easier to use STRINGS to hold text. They may not,
however, contain color or cursor control characters.
400 - The following dissects a string and converts each ASCII character to
a screen code in a range of 0-63:
FOR R=1 TO LEN(string)
CV=ASC(MID$(string,R,1)and63
Use CV in a subsequent PRINT statement followed by NEXT. For
demonstration purposes, note that T2$ is defined with every other character
SHIFTed, yet the string is printed correctly. This is not true of
Commodore/key combinations and strange things result.
530-590 - All 64 usable characters are displayed using the AB$ method.
Their values 0-63 correspond to the screen code chart in the Commodore
manual and PRG, which you can use as a reference when defining your text.
600-710 - In this routine the AB(63,4) array is used to display the
alphabet a segment at a time. To illustrate this technique, the characters
are printed in an unusual manner. However, it is just as easy to print each
complete character, one after the other.
730-870 - With CONTROL80's BLOCK command you can produce numerous effects.
This is where the AZ=2048 variable is useful. Attribute memory in the 8563
chip is located in the range of 2048-4095 ($0800-$0FFF). To affect an
attribute use:
BLOCKAZ+row*80+column,number,value
number - (0-255) indicates how many consecutive locations to fill.
value - (0-255) determines the characteristic of the attribute based on
the following:
128 - Alternate character set
64 - Reverse Video
32 - Underline
16 - Flash
15 - White
14 - Light Grey
13 - Yellow
12 - Brown
11 - Light Purple
10 - Dark Purple
9 - Light Red
8 - Dark Red
7 - Light Cyan
6 - Dark Cyan
5 - Light Green
4 - Dark Green
3 - Light Blue
2 - Dark Blue
1 - Dark Grey
0 - Black
Keep in mind that 2 x FONT is in the alternate character set so 128 is
the minimum value for all large char